 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
|
The new routine reserves a block of memory of
|
|
 |
|
|
|
|
|
the requested
size in a pool of free memory
|
|
|
called the heap.
|
|
|
|
Two
separate data storage areas are used by
|
|
 |
|
|
|
|
|
the program
during run time: the stack and the
|
|
|
heap.
|
|
|
|
n |
The lifetime of
data stored on the stack is relative to
|
|
|
the lifetime of
the subroutine that the data are
|
|
|
defined in.
|
|
|
|
n |
The lifetime of
data stored in the heap starts with the
|
|
execution of the
allocation procedure new and ends
|
|
|
when the
deallocation procedure delete is
called.
|
|